package com.icode.core.model.house;

import com.icode.core.model.AbstractEntity;

import javax.persistence.*;

/**
 * Created with IntelliJ IDEA.
 * User: sunk
 * Date: 14-12-15
 * Time: 下午2:19
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "house_info_image")
public class HouseInfoImage extends AbstractEntity {
    @ManyToOne
    @JoinColumn(name = "house_info_id")
    private HouseInfo houseInfo;

    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "image_id")
    private UploadImage image;

    public HouseInfoImage() {
    }

    public HouseInfoImage(HouseInfo houseInfo, UploadImage image) {
        this.houseInfo = houseInfo;
        this.image = image;
    }

    public HouseInfo houseInfo() {
        return houseInfo;
    }

    public UploadImage image() {
        return image;
    }

    public void update(UploadImage uploadImage) {
        this.image = uploadImage;
    }
}
